<template>
	<view class="settings Column">
		<view class="Column items-center quit" @click="logOut">
			<view class="contentBox Row">退出登录</view>
		</view>
	</view>
</template>

<script>
	import {
		apiBindInviter,
		apiLogout
	} from '@/api/weChat_login.js';

	export default {
		data() {
			return {};
		},
		methods: {
			logOut() {
				uni.showModal({
					content: '是否退出登录？',
					confirmColor: '#0056FF',
					success: ({
						cancel
					}) => {
						if (cancel) return
						apiLogout()
							.then(res => {
								if (res.code == 0) {
									uni.$u.toast(res.msg);
									return;
								}
								uni.clearStorageSync();
								uni.$u.toast("退出成功");
								setTimeout(() => {
									uni.switchTab({
										url: '/pages/mine/mine'
									})
								}, 1000)
							}).catch(err => {
								console.log(err);
							})
					}
				})
			},
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #F5F6F8;
	}

	.settings {
		display: flex;

		.quit {
			justify-content: center !important;
			flex: 1;
			background-color: #fff;
			padding: 20rpx 0;
			margin-top: 13px;

			.contentBox {
				justify-content: space-between;
				font-size: 32rpx;
			}

			.unread {
				position: absolute;
				right: 26rpx;
				top: 16rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				width: 30rpx;
				height: 30rpx;
				border-radius: 15rpx;
				background-color: red;
				font-size: 24rpx;
				color: #fff;
			}

			.iconfont {
				color: black;
				font-size: 44rpx;
				padding: 24rpx;
			}
		}
	}
</style>